import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

import model.movie;

import facade.Facade;


public class Window extends JFrame{
	
	private Facade facade;
	private JPanel panel;
	public ArrayList<Object> movieList;
	
	public Window()
	{
		this.setSize(640, 480);
		//this.setResizable(false);
		panel = new JPanel();
		//panel.setSize(300, 300);
		//panel.setBounds(10, 25, 100, 100);
		panel.setBackground(Color.WHITE);
		panel.setOpaque(true);
		this.add(panel);
		setVisible(true);
	}
	
	public void putTree() throws Exception
	{
		DefaultMutableTreeNode movies = new DefaultMutableTreeNode("Movies");
		DefaultMutableTreeNode movie = null;
		JTree tree = new JTree(movies);
		movieList = facade.createObject_L("movie");
		for (Integer x = 0; x < movieList.size(); x++)
		{
			movie = new DefaultMutableTreeNode((movie)movieList.get(x));
		    movies.add(movie);
		}
		//tree.setBounds(0, 25, 800, 575);
		tree.setOpaque(true);
		panel.add(tree);
	}
	
	public static void main (String[] args) throws Exception
	{
		Window window = new Window();
		window.facade = new Facade();
		window.movieList = window.facade.createObject_L("movie");
		window.putTree();
	}
	
}
